Skip to main content

All Questions

0votes
1answer
61views

React get data from children context inside the parent component

I'm trying to set up a form with many rows of data, with each individual items. When I click a button, I want to get all of the data from each children, and submit the form. I'm using context to ...
Chris Jeong's user avatar
1vote
1answer
34views

Why attendence Context fetching again on navigation back to the teacherattend component?

I need to use attendance data often on my website, So I make it as utility as below: import React, { useState, useEffect, useMemo, useCallback, createContext } from 'react'; import { ...
BI IYI's user avatar
2votes
2answers
65views

Context Provider not passing value to children

I am trying to create a parent/overarching context. The purpose of the context is to store UserInfo which should then be available to all children. UserInfo is set by getting config from an API. ...
Oam Psy's user avatar
  • 8,663
0votes
1answer
43views

controlling React Context - caused rendering

I am using a react App, with a context holdling a wordlist. I have a child component of the context , which uses a context function which edits the current word (setting the wordlist). When I do that ...
blumen's user avatar
0votes
1answer
59views

How to utilise useContext within a seperate function - ReactJS

I'm attempting to seperate my usage of useContext and the ensuing array manipulation into a callable function (ChangeContent) so that I can utilise it across other functions/components, instead of ...
David P's user avatar
1vote
1answer
83views

Context state not setting properly in React

The title may be ambiguous but I am having a issue that redirects me to /home after I render the component assigned to /logout, whose job is to clear the storage and reset the AuthContext states. I ...
Diwas's user avatar
1vote
1answer
129views

send form with button from another component using usecontext in react js

I'm trying to send this form inputs from component A using a button in component B. Both of them are stored in context provider I've created: context.jsx: export const SubmitContext = createContext(...
ahmedzaid aghiles's user avatar
-1votes
1answer
46views

React calling API requests before axios sets auth headers

I am trying to set up AuthContext is react and running into a problem where react calls an API before axios sets the auth headers in the request. This is causes API failures on first render missing ...
Paul's user avatar
1vote
1answer
46views

this react context "DELETE_BLOG' is not Working properly is there any problem in the code?

import { Link, useNavigate } from "react-router-dom"; import { useBlogContext } from '../Hooks/useBlogContext'; const Blogs = ({ blog }) => { const navigate = useNavigate(); ...
M. ARUN's user avatar
1vote
3answers
79views

How do I create a custom hook like useState for context value to get previous state value?

I have a context like this ProductProvider.js import React, { createContext, useMemo } from 'react' const INITIAL_HANDLER = { sortType: null, offset: 0 } export const ProductProviderContext = ...
flix's user avatar
  • 1,984
2votes
1answer
44views

React use hooks (useContext) inside of useReducer

I have a reducer inside useContext/provider. I need to validate an action using values from another Provider. Is there a way to retrieve those values from a Provider from within the useReducer hook? ...
Sean's user avatar
  • 667
-1votes
1answer
721views

Passing callback function to useContext in React

I've created simple context and custom hook to use it and i want to pass callback function through this hook. Is it even possible? Bear in mind its not the actual code, it's just supersimple ...
kabukiman's user avatar
2votes
2answers
52views

Error React Js Firebase show createUser is not a function (using Context)

I am very new to React JS and Firebase. I tried to https://medium.com/ topic "Building a Firebase Authentication and Private Route System in a React App" After modifying the code and trial ...
Supercosition's user avatar
-1votes
1answer
101views

Converting Zustand code to Context API state [closed]

I have this piece of code written in typescript for zustand state management library export const useStore = <T, F>( store: (callback: (state: T) => unknown) => unknown, callback: (...
Abdulghani Albaik's user avatar
-1votes
1answer
165views

React useContext not updating value in same component [duplicate]

I am having a sample react app with 2 components Component1 & Component2 as below. i am using useContext hook to update the context value in Component2 and reading the updated context value in ...
Ritesh Kaushik's user avatar

153050per page
close